#include "Abstraction.h"
#include "AbstractionImp.h"

#include <iostream>
using namespace std;

Abstraction::Abstraction()
{
    cout << "Abstraction::Abstraction()" << endl;
}

Abstraction::~Abstraction()
{
    cout << "Abstraction::~Abstraction()" << endl;
}

RefinedAbstraction::RefinedAbstraction(AbstractionImp* imp)
{
    _imp = imp;
    cout << "RefinedAbstraction::RefinedAbstraction(AbstractionImp* imp)" << endl;
}

RefinedAbstraction::~RefinedAbstraction()
{
    cout << "RefinedAbstraction::~RefinedAbstraction()" << endl;
    // _imp 在 RefinedAbstraction 内部不用处理
    // if (_imp) {
    //     delete _imp;
    //     _imp = nullptr;
    // }
}

void RefinedAbstraction::Operation()
{
    cout << "RefinedAbstraction::Operation()" << endl;
    _imp->Operation();
}